-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to compress and skip unserializable session attributes #10747
Add ability to compress and skip unserializable session attributes #10747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the fundamental mechanism, but find it a bit complex of how it could be used. Specifically JdbcTestHelper
suggests that a whole helper class is needed which could perhaps be done by better utilities in the main classes.
The fact that all SessionDataStores do not use this mechanism, suggest that perhaps another subclass of AbstractSessionDataStore
is needed. Perhaps a SerializedSessionDataStore
to indicate that serialization is used.
It then feels like we could definitely offer a SerializedSessionDataStore.Compressed
subclass that wraps any other SerializedSessionDataStore
and does the stream wrapping for compression.
If the replaceObject
method was delegated to a protected method on SerializedSessionDataStore
, then it too could be intercepted with a wrapper provided by us.
jetty-core/jetty-session/src/main/java/org/eclipse/jetty/session/AbstractSessionDataStore.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-session/src/main/java/org/eclipse/jetty/session/AbstractSessionDataStore.java
Outdated
Show resolved
Hide resolved
The To use the new feature in embedded mode, you would simply just create an instance of your extended DefaultSessionCache sessionCache = new DefaultSessionCache(sessionManager);
sessionCache.setSessionDataStore(new MyJDBCSessionDataStore()); If you want to use a If you want to do this via a module, then of course you need to write a
|
…compressing-nonserializable-sessions
…compressing-nonserializable-sessions
Based on features suggested for PR #10740, add the ability for SessionData subclasses to provide
ObjectOutputStream
andObjectInputStream
to customize how sessions are serialized and deserialized. In particular, this will allow for compression of session data, and also the optional skipping of non-serializable session attributes.